import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import s from './TaskStatus.module.css';
import StatusIcon from '../StatusIcon';
import { QUEUE_TASK_STATUS_MAP } from '../../../common/constants';

export default function TaskStatus({ className, status }) {
	return (
		<span className={cn(className, s.taskStatus)}>
			<StatusIcon status={status} className={s.status} />
			{QUEUE_TASK_STATUS_MAP[status]}
		</span>
	);
}

TaskStatus.propTypes = {
	className: PropTypes.string,
	status: PropTypes.string.isRequired,
};

TaskStatus.defaultProps = {
	className: s.taskStatus,
};
